<template>
	<view class="container">
		<view class="label">模板选择</view>
		<view class="list">
			<view class="list-item flex-row-center" v-for="item in list">
				<view class="list-item">
					<view :class="['radio-checked',item.id == current?'radio-active':'']"
						@click="handleChoose(item.id)"></view>
					<view class="radio-name">{{item.title}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			current: {
				type: Number,
				default: 1
			}
		},
		data() {
			return {
				list: [],
			};
		},
		mounted() {
			this.getPpt()
		},
		methods: {
			async getPpt() {
				let res = await this.$api.pptTemplate()
				this.list = res.data.data
			},
			handleChoose(id) {
				this.$emit("changePpt",id)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.label {
		line-height: $text-size;
		font-size: $text-size;
		color: #6F6F6F;
		margin-bottom: 40rpx;
	}

	.list {
		margin-bottom: 152rpx;

		.list-item {
			display: flex;
			align-items: center;

			&:not(:last-child) {
				margin-bottom: 30rpx;
			}
		}

		.radio-checked {
			width: 40rpx;
			height: 40rpx;
			box-sizing: border-box;
			border-radius: 50%;
			background: #FCFCFF;
			margin-right: 20rpx;
			border: 2rpx solid #D5D4D4;
		}

		.radio-checked.radio-active {
			border: 8rpx solid #55C867;
		}

		.radio-name {
			line-height: 28rpx;
			font-size: 28rpx;
		}
	}
</style>